import {
    defineStore
} from "pinia";

import   getHotSuggests   from "../../services/modules/hotSuggests"
import   {getCategorie}  from "../../services/modules/Categories"
import   {getHomeLists} from  "../../services/modules/homeList"
const useHomeStore = defineStore("home", {
    state: () => ({
        hotsuggests: {},
        startTime: Date(),
        endTime: Date(),
        Categories:[],
        homeList:[],
        page:0
    }),
    actions: {
         async getHotSuggest() {
            const res = await getHotSuggests();
            this.hotsuggests = res; 
            // console.log("this.hot", this.hotsuggests);
        },
        async getCategorie()
        {
            const res = await getCategorie();
            this.Categories = res.data;
            // console.log(this.Categories);
        },
        async getHomeList( )
        {
            const res = await getHomeLists(this.page);
            this.homeList.push(...res.data);
            this.page++;
            console.log("获取房屋列表数据：",this.homeList,"this.page",this.page);
        }
    }
})

export default useHomeStore;